<style>
body,html{
    height:100%;
    background: #000;
}
</style>
<body>
    
</body>
<script>
setInterval(function(){
    var imgObj=document.createElement('img')
    imgObj.src='../images/爱心.gif'
    randomWid=Math.floor(Math.random()*(80-30+1)+30)
    imgObj.style.width=randomWid+'px'
    imgObj.style.position='absolute'
    min=0
    max1=window.Height || document.documentElement.clientHeight-randomWid
    max2=window.Width || document.documentElement.clientWidth-randomWid
    imgObj.style.top=Math.floor(Math.random()*(max1-min+1)+min)+'px'
    imgObj.style.left=Math.floor(Math.random()*(max2-min+1)+min)+'px'

    document.body.appendChild(imgObj)
},1000)

 document.body.onclick=function(evt){
    var e=evt || window.event
    var target=e.target || e.srcElement
     if (target.nodeName=='IMG'){
      document.body.removeChild(target)
    }
 }

</script>
